﻿#pragma once
#include "Logging.h"
#include "Types.h"
#include <map>
#include <string>
#include <set>

class Mesh;

template<typename IndexType>
class SimpleRange
{
public:
  SimpleRange(IndexType begin, IndexType end)
    : _begin(begin)
    , _end(end)
  {
  }

  IndexType begin() const { return _begin; }

  IndexType end() const { return _end; }

private:
  IndexType _begin, _end;
};

class BoundaryInfo
{
  friend class Mesh;

public:
  BoundaryInfo();
  ~BoundaryInfo();

  void AddSide(ElemId e_id, SideId s_id, BoundaryId b_id);

  std::string& SideSetName(BoundaryId id);  

  BoundaryId GetIdByName(const std::string& name) const;
  const std::map<BoundaryId, std::string>& GetIdToName() const;
  const std::multimap<ElemId, std::pair<SideId, BoundaryId>>& GetSideSet() const;


private:
  std::map<BoundaryId, std::string> _ss_id_to_name; //side set id to name
  std::set<BoundaryId> _boundary_ids;
  std::set<BoundaryId> _side_boundary_ids;
  std::multimap<ElemId, std::pair<SideId, BoundaryId>> _boundary_side_id;

  static const BoundaryId INVALID = -1;
};

